<div>
  <div class="pull-right">
    <%= link_to "新建楼层", new_admin_floor_path, class: "btn btn-primary" %>
  </div>

  <h1>
    首页楼层(<%= @floors.total_entries %>)
  </h1>
</div>

<div>
  <table class="table table-striped">
    <tr>
      <th>楼层名</th>
      <th>所属分类</th>
      <th>商品</th>
      <th>操作</th>
    </tr>

    <% @floors.each do |floor| %>
      <tr>
        <td><%= floor.title %></td>
        <td><%= floor.category.title %></td>
        <td>
          <% products = Product.unscoped.find floor.product_ids %>
          <% products.each do |product| %>
            【<%= product.id %>】
            <%= link_to product.title, product_path(product) %><br />
          <% end %>
        </td>
        <td>
          <%= link_to "编辑", edit_admin_floor_path(floor) %>
        </td>
      </tr>
    <% end -%>
  </table>

</div>


